A peripheral unit for a programmable controller
1. Technical Field
The present invention relates to a peripheral unit for a programmable controller. More particularly, this invention relaters to a peripheral unit for a programmable controller that monitors a device of a programmable controller by communications.
2. Background Art
A peripheral unit for a programmable controller that monitors a device based on a device value of the programmable controller obtained by serial communications or the like is known.
A general structure of a conventionally known peripheral unit for monitoring will be explained with reference to FIG. 7. The peripheral unit 100 connected to a programmable controller 50 to be monitored by a communication table 120 so that it is possible to communicate in two directions.
The peripheral unit 100 is constructed of a monitoring application executing-section 101 for monitoring a device of the programmable controller 50, an application interface section 102, monitor request instruction issuing unit 103 for issuing a monitor request instruction to the programmable controller 50, monitor data obtaining unit 104 for obtaining monitor data from the programmable controller 50, and communication unit 105 for communicating with the programmable controller 50.
In the conventional peripheral unit 100, the monitoring application executing-section 101 delivers a list of a device to be monitored to the application interface section 102. The monitor request instruction issuing unit 103 issues a monitor request instruction to the programmable controller 50 via the communication unit 105 based on the device list received by the application interface section 102. The programmable controller 50 returns a value of the device in the delivered monitor device list to the monitor data obtaining unit 104 via the communication unit 50 according to the monitor request instruction received. The monitor obtaining unit 104 returns the received device value to the monitoring application 101 via the application interface section 102.
Each time when a list of a device to be monitored is delivered from the monitoring application executing-section 101, a series of processing from the issuing of a device monitor request instruction to the programmable controller 50 to the obtaining of a value of a device to be monitored from the programmable controller 50 are carried out in cascade. Therefore, there has been a problem in the conventional peripheral unit 100 that, for each monitoring request, a monitoring is kept waited until a value of a device to be monitored has been obtained from the programmable controller 50. Thus, response and efficiency of monitoring have been poor.
Therefore, the present invention has an object of providing a peripheral unit that monitors a device of a programmable controller efficiently and in good response.
The present invention can provide a peripheral unit for a programmable controller for monitoring a device of a programmable controller. The peripheral unit includes a monitor request instruction issuing-side shared memory into which a list of devices to be monitored is written according to a monitor request instruction of a monitoring application executing-section; a monitor request instruction issuing unit for issuing a monitor request instruction according to a content of the device list after the device list has been written into the monitor request instruction issuing-side shared memory; a communication unit for transmitting a monitor request instruction issued by the monitor request instruction issuing unit to the programmable controller and for receiving the monitor data according to the monitor request instruction from the programmable controller; a monitor data obtaining unit for obtaining the monitor data received from the programmable controller; and a monitor data obtaining-side shared memory into which the monitor data obtained by the monitor data obtaining unit is written, wherein the monitoring application executing-section is given the monitor data from the monitor data obtaining-side shared memory. Accordingly, the monitor request instruction issuing unit and the monitor data obtaining unit to the monitoring application executing-section are divided by the monitor request instruction issuing-side shared memory and the monitor data obtaining-side shared memory respectively. Thus, the monitor request instruction issuing unit, monitor data obtaining unit and the monitoring application executing-section can be operated mutually asynchronously. Further, a data flow becomes in one direction, and exclusive control relating to the shared memories can be minimized.
Further, the present invention can provide a peripheral unit for a programmable controller as follows. The monitor request instruction issuing-side shared memory has a rewrite-flag section for storing a rewrite-flag that shows a rewriting of the device list. The monitor request instruction issuing unit issues a monitor request instruction according to the contents of a new device list when a rewrite-flag of the monitor request instruction issuing-side shared memory has been stood and falls the last rewrite-flag, and continues to issue a monitor request instruction according to the contents of the last device list until when a next rewrite-flag of the monitor request instruction issuing-side shared memory has been stood. The monitor data obtaining-side shared memory has initialization flag section for storing a initialization flag that falls when a device list is changed and that stands when monitor data has been written into the monitor data obtaining-side shared memory after the device list has been changed, and a rewrite-flag section for storing a rewrite-flag that stands when monitor data of the monitor data obtaining-side shared memory has been rewritten by the monitor data obtaining unit and that falls when this monitor data has been read by the monitoring application executing-section. The monitoring application executing-section is given monitor data from the monitor data obtaining-side shared memory when both the initialization flag and the rewrite-flag of the monitor data obtaining-side shared memory have been stood, and is not given the monitor data from the monitor data obtaining-side shared memory when the initialization flag has fallen. Accordingly, it is possible to individually carry out flag control for a rewriting of the device list, a rewriting of monitor data (a device value), and a rewriting of monitor data after changing a device list, respectively. Thus, it is possible to carry out a required monitoring by minimizing data exchanges between the monitor request instruction issuing unit, the monitor data obtaining unit and the monitoring application executing-section.
Further, the present invention can provide a peripheral unit for a programmable controller as follows. The monitor data obtaining-side shared memory has a change flag table section for storing a device value change flag that is set for each device of a device list and that stands when a device value has changed and falls when a device value has been read. The monitor data obtaining unit updates only a device value of the monitor data obtaining-side shared memory for a device of which device value has changed, and stands a device value change flag. The monitoring application executing-section is given a device value of a device for which a device value change flag is standing, from the monitor data obtaining-side shared memory. Accordingly, a flag control of a device value change is carried out for each device. Monitor data of which device value has changed is delivered to the monitoring application executing-section in a device unit. Therefore, it is possible to minimize device values to be exchanged between the monitoring application executing-section and the monitor data obtaining unit.
Further, the present invention can provide a peripheral unit for a programmable controller as follows. A plurality of monitoring application executing-sections are provided as monitoring request origins. The monitor request instruction issuing-side shared memory and the monitor data obtaining-side shared memory are provided by a plurality of numbers respectively corresponding to the monitoring application executing-sections. The monitor request instruction issuing unit integrates the same devices based on request device lists of request origins and the programmable controller, thereby optimizing device lists. Accordingly, the monitor request instruction issuing unit can optimize device lists, and the processing at the monitoring application executing-section can be minimized. Further, it becomes possible to reduce transmission data to the programmable controller and to reduce frequency of communications.
Further, the present invention can provide a peripheral unit for a programmable controller as follows. There is provided timer monitoring unit for measuring a lapse time from when a monitor request instruction has been issued till when monitor data has been obtained. A predetermined monitoring cycle time is compared with a lapse time measured by the timer monitoring unit. When the lapse time is shorter than the monitoring cycle time, monitor processing is prohibited until when the specified cycle has reached. When the lapse time is longer than the monitoring cycle time, the priority of the monitoring is lowered. Accordingly, when the lapse time is shorter than the monitoring cycle time, the monitor processing is prohibited until when the specified cycle has reached, and when the lapse time is longer than the monitoring cycle time, the priority of the monitoring is lowered.
Further, the present invention can provide a peripheral unit for a programmable controller as follows. When the lapse time is longer than the monitoring cycle time, the monitoring cycle time is corrected so that the monitoring cycle time becomes longer. Accordingly, when the lapse time is longer than the monitoring cycle time, the monitoring cycle time is corrected so that the monitoring cycle time becomes longer.